package classes;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class DownloadStatus{
	
	private static final String SOAP_ACTION = "http://easymci.org/Webservices/TrainStatus";
	 
	private static final String OPERATION_NAME = "TrainStatus";
	 
	private static final String WSDL_TARGET_NAMESPACE = "http://easymci.org/Webservices";
	 
	private static final String SOAP_ADDRESS = "http://easymci.org/webservices/trainenquiry.asmx";
	// Method
	public SoapObject GetData(String trainNumber, String stationCode, String travelDate){
		 SoapObject result=null;
		SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
        request.addProperty("trainNumber",trainNumber);
        request.addProperty("stationCode",stationCode);
        request.addProperty("date",travelDate);
        
        try{
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        
        envelope.dotNet = true;

        envelope.setOutputSoapObject(request);
        		 
        HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
        

         
        httpTransport.call(SOAP_ACTION, envelope);
         
        result=(SoapObject)envelope.getResponse();
      
        return result;
        
    
        }
         
        catch (Exception e)
         
        {
        	
        }
        return null;
	}
	
}
